Skip to content

feat: migrate to agent-core build_agent API with provider config#21

Merged
John-Lin merged 1 commit into
masterfrom
migrate-agent-core-build-agent
Apr 19, 2026
Merged

feat: migrate to agent-core build_agent API with provider config#21
John-Lin merged 1 commit into
masterfrom
migrate-agent-core-build-agent

Conversation

@John-Lin

Copy link
Copy Markdown
Owner

Summary

  • Replace OpenAIAgent.from_dict with build_agent, which dispatches on provider.type (openai | anthropic). Unlocks Claude support and aligns with the agentic-discord-bot migration.
  • Switch config file from servers_config.jsonagent_config.json with the new opencode-style schema (provider block + mcp entries keyed by type: local | remote).
  • Inline env_flag in bot/config.py (upstream removed agent_core.env).
  • Rename openai_agent constructor arg to agent and surface AgentError with provider / subtype / session_id logging.
  • Add docker-compose.yml and run.sh; harden Dockerfile with curl git jq for MCP server tooling.
  • Update .gitignore, README, and tests to the new schema.

Test plan

  • uv run ruff check .
  • uv run ty check
  • uv run pytest (107 passed)
  • Pre-commit hooks (ruff, ruff-format, ty, uv-lock) green
  • Manual smoke: bring up docker compose up -d --build with a real token and agent_config.json, verify private + group chat flows

Notes

If a previous uv sync produced a stale agent-core layout, clear the cache and regenerate the lockfile:

uv cache clean agent-core && rm -rf .venv uv.lock && uv sync

Align with upstream agent-core's new modular layout: drop the direct
OpenAIAgent coupling in favor of build_agent, which dispatches on
provider.type (openai or anthropic). This unlocks Claude support and
matches the agentic-discord-bot migration.

- app.py: use build_agent + agent_config.json (was OpenAIAgent.from_dict
  + servers_config.json)
- bot/config.py: inline env_flag (agent_core.env was removed upstream)
  and switch default config schema to {"mcp": {}}
- bot/telegram.py: rename openai_agent constructor arg to agent, type as
  AIAgent, and surface AgentError with provider/subtype/session logging
- New agent_config.example.json using opencode-style schema
  (provider block + mcp with type: local/remote)
- README.md rewritten for the new provider/MCP schema, Claude section,
  and docker-compose/run.sh
- Dockerfile: add curl/git/jq for MCP server tooling
- Added docker-compose.yml and run.sh mirroring the discord layout
- pyproject.toml: move agent-core dep to tool.uv.sources
- Update tests to new schema and agent kwarg
@John-Lin John-Lin merged commit c891776 into master Apr 19, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant